﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace FluentUnity.Conventions
{
    public static class ConventionExtensions
    {
        public static IEnumerable<T> ApplyConditions<T>(this IEnumerable<T> source, List<Func<T, bool>> conditions)
        {
            if (conditions.Count == 0)
                return source;

            return source.Where(s => conditions.Any(c => c(s)));
        }
    }
}
